<!--
 * @FilePath     : /study_code/vue2.x/transition-element_component4.html
 * @Description  : 类名设置样式实现过渡
 * @Date         : 2025-05-03 07:59:43
 * @Author       : Fang YingGui
 * @LastEditors  : fangyinggui 18715384437@163.com
 * @LastEditTime : 2025-05-03 08:00:05
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>documentName</title>
    <style>
      /* 可以设置不同的进入和离开动画 */
      /* 设置持续时间和动画函数 */
      .slide-fade-enter-active {
        transition: all 0.3s ease;
      }

      .slide-fade-leave-active {
        transition: all 0.8s cubic-bezier(1, 0.5, 0.8, 1);
      }

      .slide-fade-enter,
    .slide-fade-leave-to

    /* .slide-fade-leave-active for below version 2.1.8 */ {
        transform: translateX(10px);
        opacity: 0;
      }
    </style>
  </head>
  <body>
    <div id="app">
      <button @click="show = !show">Toggle render</button>
      <transition name="slide-fade">
        <p v-if="show">hello</p>
      </transition>
    </div>


    <script src="/vue/dist/vue.min.js"></script>
    <script src="./common.js"></script>
    <script>
     // 自定义组件
     const myComponent = {
        data: function () {
          return {}
        },
        props: [],
        template: ``,
        methods: {},
      }

      var app = new Vue({
        el: '#app',
        data: function () {
          return { show: true }
        },
      })
    </script>
  </body>
</html>
